<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${member.id}"  type="hidden">

						  <div class="form-group" style="display: none;">
								<label class="col-sm-3 control-label">性别：</label>
								<div class="col-sm-4">
									<input id="sex" name="sex" th:value="${member.sex}" class="form-control" type="text">
								</div>
							</div>
						<div class="form-group">
								<label class="col-sm-2 control-label">名字：</label>
								<div class="col-sm-4">
									<input id="name" name="name" th:value="${member.name}" class="form-control" type="text">
								</div>
						       <label class="col-sm-2 control-label">电话：</label>
								<div class="col-sm-4">
									<input id="mobile" name="mobile" th:value="${member.mobile}" class="form-control" type="text">
								</div>
						</div>
						<div class="form-group">
								<label class="col-sm-2 control-label">密码：</label>
								<div class="col-sm-4">
									<input id="passWord" name="passWord" th:value="${member.passWord}" class="form-control" type="text">
								</div>
							</div>
						<div class="form-group" style="display: none;">
								<label class="col-sm-3 control-label">标记：</label>
								<div class="col-sm-4">
									<input id="delFlag" name="delFlag" th:value="${member.delFlag}" class="form-control" type="text">
								</div>
						</div>
						<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
						</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>

	<script type="text/javascript" >
		$().ready(function() {
			validateRule();
		});

		$.validator.setDefaults({
			submitHandler : function() {
				update();
			}
		});
		function update() {
			$.ajax({
				cache : true,
				type : "POST",
				url : "/gps/member/save",
				data : $('#signupForm').serialize(),// 你的formid
				async : false,
				error : function(request) {
					parent.layer.alert("Connection error");
				},
				success : function(data) {
					if (data.code == 0) {
						parent.layer.msg("操作成功");
						parent.reLoad();
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
						parent.layer.close(index);

					} else {
						parent.layer.alert(data.msg)
					}

				}
			});

		}
		function validateRule() {
			var icon = "<i class='fa fa-times-circle'></i> ";
			$("#signupForm").validate({
				rules : {
					name : {
						required : true
					}
				},
				messages : {
					name : {
						required : icon + "请输入名字"
					}
				}
			})
		}

	</script>
</body>
</html>